<template>
   <div>
    <el-table
      :data="arr"
      style="width: 100%; margin-bottom: 20px"
      row-key="id"
      border
      default-expand-all
      :tree-props="{ children: 'children' }"
    >
      <el-table-column prop="title" label="活动名称" sortable width="180">
        <template slot-scope="scope">
            <span>{{scope.row.title}}</span>
        </template>
      </el-table-column>
      <el-table-column label="状态">
        <template slot-scope="scope">
          <el-button type="primary" 
           v-if="scope.row.status == 1"   
            >启用</el-button
          >
          <el-button type="primary"  v-else
            >禁用</el-button
          >
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="primary"  @click="edit(scope.row.id)"
            >编辑</el-button
          >
          <el-button type="danger" 
             @click="del(scope.row.id)"
           >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { reqseckdelete } from '../../../http/api'
import { successAlert } from '../../../utils'
export default {
    props:['arr'],
    methods: {
      edit(id){
        this.$emit('willUpdate',id)
      },
      del(id){
        reqseckdelete({id}).then(res => {
          successAlert(res.data.msg);
          this.$emit('init')
        })
      }
    },
}
</script>

<style>

</style>